package com.lzwork.gpt.utility.batchjob;

import com.lzwork.utility.data.TypeEnum;

/**
 * @author LiZheng
 * @date 2024年8月1日 16:58:45
 */

public enum JobState implements TypeEnum
{
	Unknown(999, "异常"),
	Idel(0, "未开始"),
	Work(1, "处理中"),
	Done(2, "完成"),
	Break(3, "异常"),
	Stop(4, "停止中"),
	ForceStop(4, "停止中");

	int bit;
	String desc;

	JobState(int bit, String desc)
	{
		this.bit = bit;
		this.desc = desc;
	}

	public static JobState fromBit(int stateBit)
	{
		for (JobState state : values())
		{
			if (state.bit == stateBit)
				return state;
		}

		return Idel;
	}

	@Override
	public int getId()
	{
		return bit;
	}

	@Override
	public String getName()
	{
		return desc;
	}
}
